/*
 * RefreshLayoutStateListener.java
 * business
 *
 * Created by ChenTao on 2016/9/9.
 *
 * Copyright (c) 2016年 yidiandao. All rights reserved.
 */

package com.yidiandao.business.interfaces;

import com.yidiandao.business.base.SuperBaseFragment;
import com.yidiandao.business.ui.widget.view.SuperLoadingLayout;

/**
 * View层刷新状态需要实现的Listener
 */
public interface RefreshLayoutStateListener {

    /**
     * 根据数据加载的结果刷新整个布局的状态
     * <pre>
     *     1. 该方法必须在数据加载完成后调用
     *     2. 在该方法中必须调用{@link SuperBaseFragment#superRefreshLayoutState(int)}方法来刷新当前页面的状态
     * </pre>
     *
     * @param result one of
     *               {@link SuperLoadingLayout#STATE_SUCCESS},
     *               {@link SuperLoadingLayout#STATE_LOADING},
     *               {@link SuperLoadingLayout#STATE_NONE},
     *               {@link SuperLoadingLayout#STATE_EMPTY},
     *               {@link SuperLoadingLayout#STATE_ERROR}
     */
    void refreshContent(@SuperLoadingLayout.LoadState int result);

    /**
     * 根据加载数据的结果，返回页面的状态。通过在该方法中调用{@link SuperBaseFragment#superCheckListState(Object)}方法完成
     *
     * @return one of
     * {@link SuperLoadingLayout#STATE_SUCCESS},
     * {@link SuperLoadingLayout#STATE_EMPTY}
     */
    @SuperLoadingLayout.LoadState
    int checkResultObject(Object resultObject);
}
